package demo.net;

import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

import javax.net.ssl.X509TrustManager;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Class FakeX509TrustManager
 */
public class FakeX509TrustManager implements X509TrustManager {

    /** Field log */
    protected static Log log = LogFactory.getLog(FakeX509TrustManager.class.getName());

    /**
     * Method isClientTrusted
     * 
     * @param chain
     * 
     * @return
     */
    @Override
    public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
        if (log.isDebugEnabled()) {
            log.debug("isClientTrusted: yes");
        }
    }

    /**
     * Method isServerTrusted
     * 
     * @param chain
     * 
     * @return
     */
    @Override
    public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
        if (log.isDebugEnabled()) {
            log.debug("isServerTrusted: yes");
        }
    }

    /**
     * Method getAcceptedIssuers
     * 
     * @return
     */
    @Override
    public X509Certificate[] getAcceptedIssuers() {
        if (log.isDebugEnabled()) {
            log.debug("getAcceptedIssuers: none");
        }
        return null;
    }
}
